#input the directory with the temp files
$tempdir = $ARGV[0];
chomp($tempdir);
print "input DIR: $tempdir\n";
opendir(D,$tempdir) or die "no directory found";
#@files = grep { $_ ne '.' && $_ ne '..' } readdir(DIR);
@files = grep !/^\.\.?$/, readdir(D);
#print "@files\n";
foreach $val (@files)
{
	@array = split('_',$val);
	${$array[0]}[$array[2]-1] = $val;
}

@tempdir = split(/\//,$tempdir);
pop(@tempdir);
$tempdir = join('/',@tempdir);
#print $tempdir."\n";
#print "@expr\n@geno\n";
if(scalar(@expr) == scalar(@geno))
{
	for($i=0;$i<@expr;$i++)
	{
		#$n =0;
		#@expr_filetered = ();
		#@geno_filetered = ();
		open(WREXPR,">gene_expression_$i");
		open(WRGENO,">geno_type_$i");
		for($j=0;$j<@expr;$j++)
		{
			if($i != $j)
			{
				#$expr_filetered[$n] = $expr[$j];
				#$geno_filetered[$n] = $geno[$j];
				#$n++;
				print "skipped sub dataset number $i\n";
				open(BUFF,"	
				
			}	
			
		}
		close(WREXPR);
		close(WRGENO);
		#print "@expr_filetered\t@geno_filetered\n";
	}
}
else
{
	die "number of expr and genotype files are different for the eqtl process\n";
}
